import { useState } from 'react';
import './App.css';
import MsgBox from './context/MsgBox';
import Modal from './protals/Modal';


function App() {
  const [visibled, setVisibled] = useState(false)
  const showModal = () => {
    setVisibled(true)
  }
  const hiddenModal = (e) => {
    setVisibled(false)
  }
  return (
    <>
      <MsgBox />
      <button type='button' onClick={showModal}>添加</button>
      {visibled ? <Modal>
        <div className='modal' onClick={hiddenModal}>
          <h1>modal title</h1>
          <div> modal body</div>
          <div>modal foot</div>
        </div>
      </Modal> : null}
    </>
  );
}

export default App;
